<!-- 人员调度 -->

<template>
  <FormSlot label="人员调度" bind="eventMemberDtos" tip="请选择人员调度" required>
    <div>
      <span
        v-for="item in one.eventMemberDtos"
        :key="item.id"
        class="el-button--text marginRight"
        @click="toOpen(item)"
      >
        {{ item.memberUserName }}{{ item.handleUserPhone ? `(${item.memberUserPhone})` : '' }}
      </span>

      <span v-if="!isShow">
        <BtnText v-if="!CORE.isEmpty(one.eventMemberDtos)" title="清除" @click="toClear" />
        <BtnPrimary v-else title="选择" @click="toOpen()" />
      </span>
    </div>
  </FormSlot>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyMember',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixWeb('user', 'user_')],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 弹窗
     */
    toOpen(item = {}) {
      this.user_openEdit({ emergencyGroupId: item.emergencyGroupId })
    },

    /**
     * 清除
     */
    toClear() {
      this.one.eventMemberDtos = []
    },
  },
}
</script>
